/**
 * @author: zouye<yzyngz@foxmail.com>
 * @date: 2022-01-09 18:01:22
 * @copyright: zouye<yzyngz@foxmail.com>
 */
package com.yeah.voice.recognition.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONObject;
import com.yeah.voice.recognition.common.Properties;
import com.yeah.voice.recognition.common.Result;

/**
 * 获取配置信息
 */
@RestController
@RequestMapping("config/")
public class ConfigController {

	@Autowired
	private Properties properties;
	
	@RequestMapping("get")
	public Result get() {
		JSONObject obj = new JSONObject();
		obj.put("voiceLocation", properties.getVoiceLocation());
		obj.put("peopleAnswerCount", properties.getPeopleAnswerCount());
		obj.put("peopleVoiceCount", properties.getPeopleVoiceCount());
		obj.put("validVoiceName", properties.getValidVoiceName());
		obj.put("validVoiceOrder", properties.getValidVoiceOrder());
		
		obj.put("markToneList", properties.getMarkToneList());
		obj.put("stopAfterPlaySecond", properties.getStopAfterPlaySecond());
		obj.put("answerAfterPlaySecond", properties.getAnswerAfterPlaySecond());
		obj.put("replayCount", properties.getReplayCount());
		obj.put("resetIsMarkingAfterMinute", properties.getResetIsMarkingAfterMinute());
		
		obj.put("isSystemUpdate", properties.getIsSystemUpdate());
		
		return Result.ok(obj);
	}
}
